package org.jeecg.chase.modules.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

import java.io.Serializable;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.Objects;

/**
 * @author leikai
 * @version 1.0
 * @description: 商户分类
 * @date 2022/01/08/0008 15:10
 */
@Data
@TableName("adh_shop_category")
public class AdhShopCategory implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * ID
     */
    @TableId(type = IdType.ASSIGN_ID)
    private String id;
    /**
     * 父机构ID
     */
    private String parentId;

    /*
     * 分类名称
     */
    private String categoryName;

    /*
     * 级别，1为一级分类;2为二级分类
     */
    private Integer categoryLevel;
    /*
     * 状态，1启用;0停用
     */
    private Boolean categoryStatus;
    /*
     * 排序
     */
    private Integer categoryOrder;

    /**
     * 创建人
     */
    private String createBy;

    private String iconImg;
    /**
     * 创建日期
     */
    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date createTime;
    /**
     * 更新人
     */
    private String updateBy;
    /**
     * 更新日期
     */
    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date updateTime;
    @TableField(exist=false)
    private List<Map<String,Object>> couponList;
    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }

        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        if (!super.equals(o)) {
            return false;
        }
        AdhShopCategory that = (AdhShopCategory) o;
        return Objects.equals(id, that.id) &&
                Objects.equals(parentId, that.parentId) &&
                Objects.equals(categoryName, that.categoryName) &&
                Objects.equals(categoryLevel, that.categoryLevel) &&
                Objects.equals(categoryStatus, that.categoryStatus) &&
                Objects.equals(categoryOrder, that.categoryOrder) &&
                Objects.equals(createBy, that.createBy) &&
                Objects.equals(createTime, that.createTime) &&
                Objects.equals(updateBy, that.updateBy) &&
                Objects.equals(updateTime, that.updateTime);
    }

    @Override
    public int hashCode() {
        return Objects.hash(super.hashCode(), id, parentId, categoryName,
                categoryLevel, categoryStatus, categoryOrder, createBy,
                createTime, updateBy, updateTime);
    }

}
